<?php 
	$cdnUrl = Zend_Registry::get('cdnServer');
	$baseUrl = Zend_Registry::get('baseServer');
?>
<style type="text/css">
#ajaxLoader{
	display:none;
	margin: auto;
	z-index: 999;
}
</style>

<link href="<?php echo $cdnUrl?>/plugins/uni-form/css/uni-form.css" rel="stylesheet" media="screen" type="text/css" />
<link href="<?php echo $cdnUrl?>/plugins/uni-form/css/default.uni-form.css" rel="stylesheet" media="screen" type="text/css" />
<link href="<?php echo $cdnUrl?>/css/app.uni-form.css" rel="stylesheet" media="screen" type="text/css" />


<h1 class="page_title"> Recover Credentials </h1>
<div id="jobSeekerRgrnForm" style="padding:0 10px 10px 10px; border:1px solid black">
	<form action="javascript:submit();" autocomplete="false" class="uniForm">
		<fieldset>
				<div class="ctrlHolder">
					<label for="email"><em class="red">*</em> Email : </label>
					<input type="text" size="35" name="email" id="email" class="required validateEmail">
					<p class="formHint usernamehint">Youe email address.</p>
				</div>
				
				<div class="ctrlHolder">
					<label for="user_type_id"><em class="red">*</em> User Type : </label>
							<input type="radio" name="user_type_id" value="SEKR" checked="checked"/> Job Seeker &nbsp;
							<input type="radio" name="user_type_id" value="RCTR" /> Recruiter
					<p class="formHint usernamehint">Specify user type.</p>
				</div>
		</fieldset>
		
		<div class="buttonHolder">
        	<button type="submit" class="primaryAction">Email me my account information.</button>
        	<button type="reset" class="secondaryAction">Clear form</button>
      	</div>
		
	</form>
</div>

<div id="ajaxLoader">
<img src="<?php echo $cdnUrl?>/images/ajax-loader.gif"> <span>Please Wait...</span>
</div>
<script type="text/javascript" src="<?php echo $cdnUrl?>/plugins/uni-form/js/uni-form.jquery.js"></script> 
<script type="text/javascript" src="<?php echo $cdnUrl?>/plugins/uni-form/js/uni-form-validation.jquery.js"></script>
<script stype="text/javascript">
var urlEmailCredentails = "<?php $baseUrl?>/authenticate/emailcredentials";

$(function(){
    $('form.uniForm').uniform({
      prevent_submit : true
    });
});

function submit() {
	$("#ajaxLoader").css('display','block');
    $.ajax({
        url : urlEmailCredentails,
        type : "get",
        data : getValues(),
        success: function(jStatus){
        	$("#ajaxLoader").css('display','none');    
             alert('Server Message: '+ jStatus);
             setTimeout(function(){
              	window.location.reload();
              	},1000);
        },
        error: function(response) {
        	$("#ajaxLoader").css('display','none');
        	alert('Server Error: '+response);
        	setTimeout(function(){
            	window.location.reload();
            	},1000);
        }
    });
}

function getValues() {
    var formData = {oper:'mail'}; 
    $('form.uniForm :input')
    		.not('button,:input[value^="e.g."]')
    		.each(function(){ 
    			formData[this.name] = this.value; 
        });
    var user_type_id = $('input:radio[name=user_type_id]:checked').val();
    formData.user_type_id = user_type_id; 
	return formData;
}
</script>
